
# Common variables
# sfmv
# age
# woman
# community
# country
# wave
# not_panel

ug1_no_imp <- 
  ug1_no_imp %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = age, 
    woman = female, 
    country = "ug", 
    wave = 1, 
    community = paste0(country, wave, as.integer(tc)), 
    not_panel = 1
  )
ug2_no_imp <- 
  ug2_no_imp %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = age, 
    woman = female, 
    country = "ug", 
    wave = 2, 
    community = paste0(country, wave, as.integer(tc_id)), 
    not_panel = 1
  )
ug3_no_imp <- 
  ug3_no_imp %>% 
  mutate(
    sfmv = demand_mobs_binary, 
    age = age, 
    woman = female, 
    country = "ug", 
    wave = 3, 
    community = paste0(country, wave, as.integer(tc_id)), 
    not_panel = as.numeric(!id %in% ug2_no_imp$id)
  )
tan_no_imp <- 
  tan_no_imp %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = age_q2_3, 
    woman = female, 
    country = "ta", 
    wave = 1, 
    community = paste0(country, wave, as.integer(village)), 
    not_panel = 1
  )
tan2_no_imp <- 
  tan2_no_imp %>% 
  mutate(
    sfmv = beat_thief, 
    age = b_age %>% as.numeric(), 
    woman = female, 
    country = "ta", 
    wave = 2, 
    community = paste0(country, wave, as.integer(village_c)), 
    not_panel = 1
  )
tan3_no_imp <- 
  tan3_no_imp %>% 
  mutate(
    sfmv = beat_thief, 
    age = resp_age, 
    woman = female, 
    country = "ta", 
    wave = 3, 
    community = paste0(country, wave, as.integer(as.factor(s1q4_village))), 
    not_panel = 1
  )

sa_no_imp <- 
  sa_no_imp %>% 
  mutate(
    sfmv = support_mob_driver, 
    age = q20 %>% as.character() %>% as.numeric(), 
    woman = female, 
    country = "sa", 
    wave = 1, 
    community = paste0(country, wave, as.integer(community)), 
    not_panel = 1
  )


common_variables <- 
  c(
    "sfmv",
    "age",
    "woman",
    "country",
    "wave",
    "community",
    "not_panel"
  )


full_data_no_imp <- 
  rbind(
    ug1_no_imp %>% select(.vars = all_of(common_variables)),
    ug2_no_imp %>% select(.vars = all_of(common_variables)),
    ug3_no_imp %>% select(.vars = all_of(common_variables)),
    tan_no_imp %>% select(.vars = all_of(common_variables)),
    tan2_no_imp %>% select(.vars = all_of(common_variables)),
    tan3_no_imp %>% select(.vars = all_of(common_variables)),
    sa_no_imp %>% select(.vars = all_of(common_variables)))

names(full_data_no_imp) <- common_variables

























